using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Backend.JYD.Model;

namespace Backend.JYD.EFDAL.Mapping
{
    public class UserInfoMap : EntityTypeConfiguration<UserInfo>
    {
        public UserInfoMap()
        {
            // Primary Key
            this.HasKey(t => t.UserId);

            // Properties
            this.Property(t => t.UserName)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.AliasName)
                .HasMaxLength(50);

            this.Property(t => t.CustNo)
                .HasMaxLength(20);

            this.Property(t => t.UserType)
               .IsRequired();

            // Table & Column Mappings
            this.ToTable("UserInfo");
            this.Property(t => t.UserId).HasColumnName("UserId");
            this.Property(t => t.UserName).HasColumnName("UserName");
            this.Property(t => t.AliasName).HasColumnName("AliasName");
            this.Property(t => t.Gender).HasColumnName("Gender");
            this.Property(t => t.CustNo).HasColumnName("CustNo");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.UserType).HasColumnName("UserType");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
            this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
            this.Property(t => t.OpId).HasColumnName("OpId");
        }
    }
}
